<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <table id="exam_danke_prizedg">
        <thead>
            <tr>
                {volist name="list" id="vo"}
                    <th data-options="field:'{$vo}'">{$vo}</th>
                {/volist}
            </tr>
        </thead>
    </table>
    <div id="exam_danke_prizetb">
        <form id="exam_danke_prizeForm" class="m5">
            <div>
                学期：
                <select class="easyui-combobox" id="termId" name="termId" data-options="width:120,panelHeight:'auto',value:'请选择', editable:false,textField:'学期名称',valueField:'ID',url:'/compent/Util/termList',onSelect:changeTerm"></select>
                <select id="gradeId" name="gradeId" class="easyui-combobox" data-options="width:80,panelHeight:'auto',url:'/compent/Util/gradeNameList',onSelect:changeGrade"></select>
                <select id="examId" name="examId" class="easyui-combobox" data-options="width:120,panelHeight:'auto',editable:false"></select>
                <select id="clazz" name="clazz" class="easyui-combobox" data-options="width:80,editable:false"></select>
                <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="queryOk('exam_danke_prize')">查询</a>
                <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm1('exam_danke_prize')">重置</a>
                <a class="easyui-linkbutton" href="javascript:void(0)" data-options="iconCls:'icon-save'" onclick="zoutExcel('exam_danke_prize','/examScore/exam_danke_prize')">导出为EXCEL</a>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        $(function(){
            var url = "/examScore/exam_danke_prize";
            initDatagrid("exam_danke_prize",url);
        })  
        function changeTerm(record){
            var gradeId = $('#gradeId').combobox('getValue');
            if(!gradeId) return;
            var url="/compent/util/getTermExam?termId="+record.ID+"&grade="+gradeId;
            $('#examId').combobox('setValue','');
            $('#examId').combobox('reload',url);
        }
        function changeGrade(record){
            var termId = $('#termId').combobox('getValue');
            if(!termId) return;
            var url="/compent/util/getTermExam?termId="+termId+"&grade="+record.value;
            $('#examId').combobox('setValue','');
            $('#examId').combobox('reload',url);
            var termName = $('#termId').combobox('getText');
            var termKey = termName.substr(termName,4);
            var grade = getGrade(termKey,record.value);
            var url="/compent/Util/clazzList?grade="+grade;
            $('#clazz').combobox('setValue','');
            $('#clazz').combobox('reload',url);
        }
        function loadSubject(record) {
            var url="/examScore/clazz_subject_strength/examSubject?examId="+record.value;
            $('#subject').combobox('setValue','');
            $('#subject').combobox('reload',url);
        }
        function queryOk(cf){
            var termName = $('#termId').combobox('getText');
            var termKey = termName.substr(termName,4);
            var gradeId = $('#gradeId').combobox('getValue');
            var grade = getGrade(termKey,gradeId);
            var examId = $('#examId').combobox('getValue');
            var clazz = $('#clazz').combobox('getValue');
           //var subject = $('#subject').combobox('getValue');
            if(examId){
                $('#'+cf+'dg').datagrid('load',{grade:grade,examId:examId,gradeId:gradeId,clazz:clazz});
            }else{
                $.messager.alert('操作提示','请选择考试名称和学科。');
            }
        }
        function zoutExcel(cf, url){
            var termName = $('#termId').combobox('getText');
            var termKey = termName.substr(termName,4);
            var gradeId = $('#gradeId').combobox('getValue');
            var grade = getGrade(termKey,gradeId);
            var examId = $('#examId').combobox('getValue');
            var clazz = $('#clazz').combobox('getValue');
            //var subject = $('#subject').combobox('getValue');
            if(examId){
                var params = $('#'+cf+'Form').serialize();
                params += "&grade=" + grade;
                window.location.href = url+"/exportExcel.html?" + params;
            }else{
                $.messager.alert('操作提示','请选择考试名称和学科。');
                return;
            }
        }
    </script>
</body>
</html>